/**
 * Created by chenweicheng on 7/3/2017.
 */
'use strict';

/**
 * 本文件为ProtobufJsManager的配置文件
 * 修改时只需修改协议内容，headerType 内容,getParseMessage switch内容即可
 *
 */






var toothProtocol = "package myProto;\n" +
    "syntax = \"proto3\";\n" +
    "\n" +
    "message ToothbrushMessage {\n" +
    "\tuint32 LoopCount = 1;\n" +
    "\tuint32 Power = 2;\n" +
    "\tuint32 Mode = 3;\n" +
    "\tuint32 BrushedTime = 4;\n" +
    "\tuint32 CleanTime = 5;\n" +
    "\tuint32 SensitiveTime = 6;\n" +
    "\tuint32 WhiteningTime = 7;\n" +
    "\tuint32 BindId = 8;\n" +
    "}\n" +
    "\n" +
    "message ToothbrushQuery {\n" +
    "\tuint32 LoopCount = 1;\n" +
    "\tuint32 Gotit = 2;\n" +
    "\tuint32 Timestamp = 3;\n" +
    "\tuint32 Reset = 4;\n" +
    "}\n" +
    "\n" +
    "message ToothbrushUserData {\n" +
    "\tbool LoopCount = 1;\n" +
    "\trepeated Toothbrushdata  data = 2;\n" +
    "\tmessage Toothbrushdata {\n" +
    "\t\tuint32 Clean_TimeLength = 1;\n" +
    "\t\tuint32 Sensitive_TimeLength = 2;\n" +
    "\t\tuint32 Whitening_TimeLength = 3;\n" +
    "\t\tuint32 StartTime = 4;\n" +
    "\t}\n" +
    "}";


class ProtobufJsSupport {

    getProto() {
        return toothProtocol
    }

    getParseMessageName(messageId) {
        switch (messageId) {
            case this.headerType.ToothbrushMessage:
                return "myProto.ToothbrushMessage";
            case this.headerType.ToothbrushQuery:
                return "myProto.ToothbrushQuery";
            case this.headerType.ToothbrushUserData:
                return "myProto.ToothbrushUserData"
        }
    }


    headerType = {
        ToothbrushMessage: 0,
        ToothbrushQuery: 1,
        ToothbrushUserData: 2
    };

}


module.exports = new ProtobufJsSupport();